﻿using System.Web;
using System.Web.Mvc;
namespace JF.WebSite.App_Start
{
    public class CheckLoginAttribute: ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            HttpCookie cookie = HttpContext.Current.Request.Cookies["UserCook"];
            if (cookie != null)
            {
                base.OnActionExecuting(filterContext);
            }
            else
            {
                filterContext.Result = new RedirectResult("/Home/Login");
            }
        }
    }
}